﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using WEBWeixinSDK;

namespace WxLogin
{
    public partial class FormDL2 : Form
    {
        public FormDL2()
        {
            InitializeComponent();
        }

        private void FormDL2_Load(object sender, EventArgs e)
        {

            Image imstr = WEBWeixinSDK.Weixin.Getjslogin();
            if (imstr != null)
            {
                this.pictureBox1.Image = imstr;
            }
            if (IsHandleCreated)
            {
                Weixin.BELoginStatus(this, LoginStatus);
                Thread thread = new Thread(Weixin.Get_UserLogin);
                thread.Start();
            }
              
        }
        public void LoginStatus(Weixin.LoginStatus status)
        {
            TabMainForm f2 = new TabMainForm();
            switch (status)
            {
                case Weixin.LoginStatus.LoginSuccess:
                  //  TabMainForm tab = new TabMainForm();
                    //MainForm f = new MainForm();
                    this.Close(); //MainL objfrm = new MainL();
                   // Weixin. ExecuteEventLoginStatus(Weixin.LoginStatus.dlSuccess);
                    break;

            }
        }
    }
}
